package rong;

import java.util.Random;

import javax.swing.JFrame;

public class RunMain {
	
	public static void main(String[] args) {
		RBTree t = new RBTree();
		JFrame jf = new JFrame();  
        jf.setBounds(0, 0, 1000, 1000);  
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        TreePanel jp = new TreePanel(t);
        TreeListener.listenPanel(jp);
        jf.add(jp);
        jf.setVisible(true);  
        Random r = new Random(System.currentTimeMillis());
		for (int i=0;i<15;i++) {
			int n = r.nextInt(100);
			t.add(n);
			jp.repaint();
			System.out.print(n+" ");
			try {
				Thread.sleep(30);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}